<!doctype html>
<html lang="zh-CN">

<head>
    <title>注册</title>
    <meta charset="utf-8">
    <link rel="stylesheet" href="./css/reset.css">
    <link rel="stylesheet" href="./css/el/index.css">
    <link rel="stylesheet" href="./css/regiset1.css">
    <link rel="stylesheet" href="./css/regiset2.css">
</head>

<body>
    <div id='app' class='dis-cen' v-loading='loading'>
        <div class='dis-spa login-wrap'>
            <div>
                <img src="./img/login-bg2.png" width="100%" height="100%">
            </div>
            <div class='login-input'>
                <div>
                    <img class='logo-img' src="./img/login-bg3.png" height="50px">
                    <input type="password" placeholder="设置密码（8-20位的数字或字母）" v-model='pas'>
                    <div class='invi-code'>
                        <input class='put' type="password" placeholder="确认密码" v-model='pasSure'>
                        <!-- <span>输入有误</span> -->
                    </div>
                    <a class='login-btn hover' @click='sure'>完成注册</a>
                    <p class='dis-spa forget'>
                        <span>
                            注册即同意
                            <a href="">《用户协议》</a>
                        </span>
                        <a href="./login.html">去登陆</a>
                    </p>
                </div>

            </div>
        </div>
    </div>
    <script src="./js/jquery.min.js"></script>
    <script src="./js/jquery.cookie.js"></script>
    <script src="./js/com.js"></script>
    <script src="./js/vue.min.js"></script>
    <script src="./js/el/index.js"></script>
    <script>
        var app = new Vue({
            el: '#app',
            data: {
                loading: false,
                pas: '',
                pasSure: '',
                //注册1过来的key值
                key: ''
            },
            created: function() {
                this.key = _gethash().key;
            },
            methods: {
                sure: function() {
                    if (!this.key) {
                        this.$message.error('请正确的进行注册');
                        setTimeout(function() {
                            _openHref({
                                url: './regiset1.html'
                            });
                        }, 1200);
                        return;
                    }
                    if (!this.pas || this.pas != this.pasSure) {
                        this.$message.error('密码输入不一致');
                        return;
                    }
                    var This = this;
                    this.loading = true;
                    AJAX({
                        url: REGISTER,
                        app: this,
                        data: {
                            password: this.pas,
                            key: this.key
                        },
                        success: function(data) {
                            This.loading = false;
                            if (data.Status == '0') {
                                This.$message.error('注册成功，请登录！');
                                setTimeout(function() {
                                    _openHref({
                                        url: './login.html'
                                    });
                                }, 1200);
                            } else {
                                This.$message.error('注册失败，请稍后再试！');
                            }
                        }
                    });
                }
            }
        });
    </script>
</body>

</html>